package CharacterString;

public class putTogether {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3};
        String result = arrToString(arr);
        System.out.println(result);
        ////
        System.out.println(reverser(result));
    }
////////并接字符串方法：
    public static String arrToString(int[] arr) {
        if (arr == null) {
            return " ";
        }
        if (arr.length == 0) {
            return "[]";
        }
        String result = "[";
        for (int i = 0; i < arr.length; i++) {
            if (i != arr.length - 1) {
                result += arr[i] + ",";
            } else {
                result += arr[i];
            }
        }
        result += "]";
        return result;
    }
    //////反转字符串方法；
    public static String reverser(String str ){
        String result = "";
        for (int i = str.length()-1; i >= 0; i--) {
            char c = str.charAt(i);
            result += c;
        }return result;
    }
}

